package com.project.service.petInfoService.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.PetInfoBean;
import com.project.mapper.petInfoMapper.IPetInfoMapper;
import com.project.service.petInfoService.IPetInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class PetInfoServicelmpl implements IPetInfoService {
    @Autowired
    private IPetInfoMapper mapper;

    @Override
    public PageInfo<PetInfoBean> findByItem(int pageNO, String city, String type) {
        PageHelper.startPage(pageNO,PAGESIZE);
        return PageInfo.of(mapper.findByItem(city, type));
    }

    @Override
    public PageInfo<PetInfoBean> findByName(int pageNO, int userId) {
        PageHelper.startPage(pageNO,PAGESIZE);
        return PageInfo.of(mapper.findByName(userId));
    }

    @Override
    public void del(int petId) {
        mapper.del(petId);
    }

    @Override
    public void add(PetInfoBean petInfo, int userId) {
        mapper.add(petInfo,userId);
    }
}
